$(function() {

	var vm = new Vue({
		el: '#app',
		data: {
			hreHtml: "../orderReport/index.html",
			leftArry: [{
				name: "欢迎页",
				type: 6,
			}],
			user:{},
			categoryIndex: 0,
			activeIndex: "1",
		},
		computed: {
			computedIndex() {
				return this.activeIndex;
			}
		},
		created:function(){
		   this.getAdminUserInfo()	
		},
		methods: {
			getAdminUserInfo() {
				this.fullscreenLoading = true;
				axios({
					url: POSTURL.getAdminUserInfo,
					method: 'post',
					data: {}
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						 this.user = response.data.result
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			},
			quitManager() {
				window.location.replace('../../index.html')
				storage.clear();
			},
			changNavSelect(target, index, path) {
				this.activeIndex = target
				this.getLeftNav(target)
				this.handleOpen(path, index)
			},
			handleSelect(key, path) {
				this.activeIndex = key
				this.categoryIndex = 0
				this.getLeftNav(key)
				this.handleOpen(this.leftArry[0].type, 0);
			},
			getLeftNav(key, path) {
				this.activeIndex = key
				console.log("key:", key);
				this.categoryIndex = 0
				if (key == "1") {
					this.leftArry = [{
						name: "欢迎页",
						type: 1,
					}]
				} else if (key == "2") {
					this.leftArry = [{
						name: "会员列表",
						type: 21
					}, {
						name: "注册用户列表",
						type: 22,
					}
					]

				} else if (key == "3") {
					this.leftArry = [{
							name: "店铺列表",
							type: 31
						},
						{
							name: "申请店铺列表",
							type: 33
						},
						{
							name: "审核店铺编辑信息",
							type: 35
						},
						{
							name: "提现申请",
							type: 36,
						},
						{
							name: "提现历史记录",
							type: 37,
						},
						{
							name:"添加首页菜单",
							type:38
						},
						{
							name:"添加首页广告图",
							type:39
						},
						{
							name:"店铺精选",
							type:40
						},
						{
							name:"分类轮播图",
							type:80,
						}
					]

				} else if (key === "4") {
					this.leftArry = [{
							name: "管理员列表",
							type: 41,
						},
						{
							name: "添加管理员",
							type: 42,
						}
					]
				} else if (key == "5") {
					this.leftArry = [{
							name: "待处理的退款订单列表",
							type: 51,
						},
					    {
							name: "退款历史记录",
							type: 53,
						},{
							 name:"所有订单",
							 type:54,
						},
						{
							name:"客服介入" ,
							type:55,
						},
						{
							name:"待审核的订单",
							type:57
						}
					]
				} else if (key == "6") {
					this.leftArry = [{
							name: "待审核商品列表",
							type: 64,
						},
						{
							name: "优惠券列表",
							type: 65,
						},
						{
							name: "商品分类列表",
							type: 61,
						},
						{
							name:"所有商品列表",
							type: 67,
						},
						{
							 name:"添加首页轮播图",
							 type:70,
						}
					]
				} else if (key == "7") {
					
					this.leftArry = [
						{
							name: "自营店铺列表",
							type: 71,
						},
						
					]
				}
			},
			mouted: function() {
				this.$nextTick(function() {

				})
			},
			handleOpen(key, index) {
				this.categoryIndex = index
				//首页
				if (key == 1) {
					this.hreHtml = "../orderReport/index.html"
				}
				//会员列表
				if (key == 21) {
					this.hreHtml = "../member/index.html"
				}
				//注册用户（未开通用户）
				else if (key == 22) {
					this.hreHtml = "../registerUser/index.html"
				}
				//店铺列表
				else if (key == 31) {
					this.hreHtml = "../shop/index.html"
				}
				//添加店铺
				else if (key == 32) {
					this.hreHtml = "../addShop/index.html"
				}
				//申请店铺列表
				else if (key == 33) {
					this.hreHtml = "../applyShop/index.html"
				} else if (key == 35) {
					this.hreHtml = "../editShopApplyList/index.html"
				} else if (key == 36) {
					this.hreHtml = "../withDraw/index.html"
				} else if (key == 37) {
					this.hreHtml = "../drawHistory/index.html"
				}
				else if (key == 38){
					this.hreHtml = "../addHomeMenu/index.html"
				}
				else if (key == 39){
					this.hreHtml = "../addHomeBg/index.html"
				}
				else if (key == 40){
					this.hreHtml = "../addHomeShopBg/index.html"
				}
				else if (key == 80) {
					this.hreHtml = "../addCategoryShopBg/index.html"
				}
				//管理员列表
				else if (key == 41) {
					this.hreHtml = "../permission/index.html";
				}
				//添加管理员账号
				else if (key == 42) {
					this.hreHtml = "../addManager/index.html";
				}
				//订单
				else if (key == 51) {
					this.hreHtml = "../orderList/index.html";
				} else if (key == 52) {
					this.hreHtml = "../refoundMoney/index.html";
				} else if (key == 53) {
					this.hreHtml = "../refoundHistory/index.html";
				}
				else if (key == 54){
					this.hreHtml = "../plartOrderList/index.html";
				}
				else if (key == 55){
					this.hreHtml = "../auditOrderList/index.html";
				}
				else if (key == 56){
					this.hreHtml = "../auditHistoryList/index.html"
				}
				else if (key ==57){
					this.hreHtml = "../auditWaitOrderList/index.html"
				}
				
				//分类列表
				else if (key == 61) {
					this.hreHtml = "../goodFristType/index.html"
				}
				//添加商品分类
				else if (key == 62) {
					this.hreHtml = "../addGoodType/index.html"
				}
				//查看商品二级分类
				else if (key == 63) {
					this.hreHtml = "../goodSecondType/index.html"
				}
				//商品库
				else if (key == 64) {
					this.hreHtml = "../goodStock/index.html"
				}
				//优惠券
				else if (key == 65) {
					this.hreHtml = "../couponList/index.html"
				}
				//添加优惠券
				else if (key == 66) {
					this.hreHtml = "../addCoupon/index.html"
				}
				//添加优惠券类型
				else if (key == 60){
					this.hreHtml = "../addCouponType/index.html"
				}
				else if (key == 67){
					this.hreHtml = "../goodList/index.html"
				}
				else if (key == 70){
					this.hreHtml = "../addHomeCover/index.html"
				}
				else if (key == 71){
					this.hreHtml = "../platShopList/index.html"
				}
				else if (key == 72){
					this.hreHtml = "../addPlartShop/index.html"
				}
				
			},

		}
	})
	window.vueData = vm;

})
